package com.alkaid.anime.controller;

import com.alkaid.anime.service.IndicatorService;
import com.alkaid.commons.controller.BaseController;
import com.alkaid.commons.entity.Indicator;
import com.alkaid.commons.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Kylin
 */
@RestController
@RequestMapping("api/anime")
public class IndicController extends BaseController {

    private IndicatorService indicatorService;

    @Autowired
    public void setIndicatorService(IndicatorService indicatorService) {
        this.indicatorService = indicatorService;
    }

    /**
     * 轮播图
     *
     * @param page the page
     * @return the indicator
     */
    @GetMapping("/indicator")
    public JsonResult<List<Indicator>> getIndicator(int page) {
        List<Indicator> indicators = indicatorService.getIndicators(page);
        return new JsonResult<>(200, indicators, "success");
    }
}
